package com.ming.ming;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@RequestMapping("/hello")
public class MingApplication {

	public static void main(String[] args) {
		SpringApplication.run(MingApplication.class, args);
		System.out.println("demo3启动！");
	}
	
	@Value("${server.port}")
	private Integer port;
	
	private final static String ipAddress = "127.0.0.1";
	
	@Bean
	public MingConfig getJGossipUtils() throws Exception {
		// 初始化
		MingConfig mg = MingConfig.init(port, ipAddress, ""+port);

		// 注册自己
		mg.getGossipService().start();
		
		return mg;
	}
}
